<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :footer="null"
    switchFullscreen
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-table
      ref="table"
      size="middle"
      :scroll="{x:true}"
      class="j-table-force-nowrap"
      bordered
      :data-source="materialData"
      :columns="columns"
      :pagination="false"
      :rowKey="(record,index)=>{return index}"
    >
    </a-table>
  </j-modal>
</template>

<script>
  export default {
    name: "inDepositoryInfoModal",
    data() {
      return {
        materialData: [],
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: '3%',
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title: '名称',
            dataIndex: 'materialName',
            width: '13%',
            align: "center",
            scopedSlots: {customRender: 'materialName'},
          },
          {
            title: '型号',
            dataIndex: 'modelNumber',
            width: '12%',
            align: "center",
            scopedSlots: {customRender: 'modelNumber'},
          },
          {
            title: '规格',
            dataIndex: 'specifications',
            width: '13%',
            align: "center",
            scopedSlots: {customRender: 'specifications'},
          },
          {
            title: '品牌',
            dataIndex: 'brand',
            width: '12%',
            align: "center",
            scopedSlots: {customRender: 'brand'},
          },
          {
            title: '市场价',
            dataIndex: 'marketPrice',
            width: '5%',
            align: "center",
            scopedSlots: {customRender: 'marketPrice'},
            customRender:function (text) {
              return text == null ? "-" : text+"元"
            }
          },
          {
            title: '预算价',
            dataIndex: 'estimatedCost',
            width: '5%',
            align: "center",
            scopedSlots: {customRender: 'estimatedCost'},
            customRender:function (text) {
              return text == null ? "-": text+"元";
            }
          },
          {
            title: '采购数量',
            dataIndex: 'purchaseMaterialNum',
            width: '5%',
            align: "center",
            scopedSlots: {customRender: 'purchaseMaterialNum'},
          },
          {
            title: '已入库数量',
            dataIndex: 'receivedNum',
            width: '5%',
            align: "center",
            scopedSlots: {customRender: 'receivedNum'},
          },
          {
            title: '待入库数量',
            dataIndex: 'notWarehousedNum',
            width: '5%',
            align: "center",
            scopedSlots: {customRender: 'notWarehousedNum'},
          },
        ],
        title: '',
        width: '90%',
        visible: false,
        disableSubmit: false,
        fullscreen: true,
        model: {},
        beLaidUpStatus: 0,
        labelCol: {
          xs: {span: 24},
          sm: {span: 5},
        },
        wrapperCol: {
          xs: {span: 24},
          sm: {span: 16},
        },
        url: {

        }
      }
    },
    methods: {
      showInDepositoryInfo(materialData){
        this.visible = true;
        if (this.beLaidUpStatus != 1){
          this.materialData = materialData;
        }
      },
      close() {
        this.$emit('close');
        this.visible = false;
      },
      handleCancel() {
        this.close()
      },
    },
  }
</script>

<style scoped>

</style>